function binSearch(arr, data) {
    let right = arr.length - 1;
    let left = 0;
    while (left <= right) {
        let mid = Math.floor((right - left) / 2);
        if (arr[mid] > data) {
            left = mid + 1;
        } else if (arr[mid] > data) {
            right = mid - 1;
        } else {
            return mid
        }
    }
}